package Lab02;
interface Boss{
    void attack();// 攻击
    void animation();//移动
    void recoveryHealth();//回血
}
//Golem类
class Golem implements Boss{
    String name;//名字
    int health;//生命值

    public Golem() {
    }

    public Golem(String name, int health) {
        this.name = name;
        this.health = health;
    }

    @Override
    public void attack() {
        System.out.println("名字："+name+"当前血量："+health);
        System.out.println(name+"发动攻击！");
    }

    @Override
    public void animation() {
        System.out.println("Boss移动方式：曲线移动");
    }

    @Override
    public void recoveryHealth() {
            health +=20;
            System.out.println(name+"回血成功当前血量为："+health);
    }
}
//Zelos类
class Zelos implements Boss{
    String name;//名字
    int health;//生命值

    public Zelos() {
    }

    public Zelos(String name, int health) {
        this.name = name;
        this.health = health;
    }

    @Override
    public void attack() {
        System.out.println("名字："+name+"当前血量："+health);
        System.out.println(name+"发动攻击！");
    }

    @Override
    public void animation() {
        System.out.println("Boss移动方式：飞行移动");
    }

    @Override
    public void recoveryHealth() {
            health += 30;
            System.out.println(name+"回血成功当前血量为："+health);
    }
}
public class Test {
    public static void main(String[] args) {
        Golem golem = new Golem("Golem",3);
        System.out.println("Boss名称："+golem.name+" 当前血量："+golem.health);
        golem.animation();
        golem.attack();
        System.out.println("-----------------------------------");
        Zelos zelos = new Zelos("Zelos",45);
        System.out.println("Boss名称："+zelos.name+" 当前血量："+zelos.health);
        zelos.animation();
        zelos.attack();
        System.out.println("-----------------------------------");
        System.out.println("Boss回血机制测试：");
        if (golem.health<10){
            golem.recoveryHealth();
        }
        if (zelos.health<10){
            zelos.recoveryHealth();
        }
    }

}
/*
*运行结果：
*Boss名称：Golem 当前血量：3
*Boss移动方式：曲线移动
*名字：Golem当前血量：3
*Golem发动攻击！
*-----------------------------------
*Boss名称：Zelos 当前血量：45
*Boss移动方式：飞行移动
*名字：Zelos当前血量：45
*Zelos发动攻击！
*-----------------------------------
*Boss回血机制测试：
*Golem回血成功当前血量为：23
*/
